package com.inputabc.qrcoderv1.ui.mainform.component;

import com.github.jaiimageio.plugins.tiff.EXIFGPSTagSet;
import lombok.Data;
import sun.security.krb5.internal.tools.Kinit;

import javax.swing.*;
import java.awt.*;

/**
 * 二维码面板
 *
 * @author gaoweiyi
 */
@Data
public class QRPanel extends JPanel {
    private JLabel qrcodeImageLabel;
    private JButton exportButton;
    private JButton importButton;

    public QRPanel() {
        init();
    }

    public void init() {
        setLayout(null);

        qrcodeImageLabel = new JLabel();
        qrcodeImageLabel.setName("qrcodeImageLabel");
        qrcodeImageLabel.setBorder(BorderFactory.createLineBorder(Color.black));
        qrcodeImageLabel.setBounds(65, 20, 300, 300);
        add(qrcodeImageLabel);

        exportButton = new JButton();
        exportButton.setName("exportButton");
        exportButton.setEnabled(false);
        exportButton.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().getImage(QRPanel.class.getResource("/img/export.png"))));
        exportButton.setBounds(qrcodeImageLabel.getX() + 30
                , qrcodeImageLabel.getY() + qrcodeImageLabel.getHeight() + 30
                , 55, 40);
        exportButton.setBorder(BorderFactory.createEmptyBorder());
        exportButton.setBackground(getBackground());
        exportButton.setToolTipText("导出二维码");
        add(exportButton);

        importButton = new JButton();
        importButton.setName("importButton");
        importButton.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().getImage(QRPanel.class.getResource("/img/import.png"))));
        importButton.setBounds(exportButton.getX() + exportButton.getWidth() + 135
                , exportButton.getY()
                , exportButton.getWidth()
                , exportButton.getHeight());
        importButton.setBorder(BorderFactory.createEmptyBorder());
        importButton.setBackground(getBackground());
        importButton.setToolTipText("导入二维码");
        add(importButton);

    }
}
